//
//  STSettingTableViewCell.m
//  赛拓
//
//  Created by 王磊 on 7/30/16.
//  Copyright © 2016 立金所. All rights reserved.
//

#import "STSettingTableViewCell.h"

@interface STSettingTableViewCell()
@property (nonatomic ,strong) UILabel *detailLabel;

@property (nonatomic ,strong) UILabel *text;

@end
@implementation STSettingTableViewCell
- (void)configSubViews {
    [super configSubViews];
    
    self.layer.borderColor = ST_EDGE_COLOR.CGColor;
    
    self.layer.borderWidth = 0.5;
    
    UILabel *text = [[UILabel alloc]init];
    
    self.text = text;
    
    text.textColor = ST_BLACK_COLOR;
    
    [self addSubview:text];
    
    UILabel *detailLabel = [[UILabel alloc]init];
    
    detailLabel.textColor = ST_BLACK_COLOR;
    
    detailLabel.textAlignment = NSTextAlignmentRight;
    
    self.detailLabel = detailLabel;
    
    [self addSubview:detailLabel];
}
- (void)updateData:(id)data andAccessoryViewData:(id)accData {
    
    NSString *text = data;
    
    self.accessoryType = [text isEqualToString:@"退出登录"] || [text isEqualToString:@"清除本地缓存"] ? UITableViewCellAccessoryNone :UITableViewCellAccessoryDisclosureIndicator;
    
    self.text.text = text;
    
    self.text.textAlignment = [text isEqualToString:@"退出登录"] ?  NSTextAlignmentCenter : NSTextAlignmentLeft;
    
    self.detailLabel.hidden = [text isEqualToString:@"退出登录"] || [text isEqualToString:@"帮助与反馈"];
    
    self.detailLabel.text = accData;
}

- (void)onBtnClick {
    
    [self.mDelegate onItemClick:STItemClickTypePwdBack withData:nil forIndexPath:nil];
    
}
#define margin 10
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.text.frame = CGRectMake(10, 0, self.k_width, self.k_height);
    
    self.detailLabel.frame = CGRectMake(0, 0, self.k_width - 60 * ST_RATE, self.k_height);
    
}

@end
